const Mongoose = require('mongoose')
// 将schema对象转化为数据模型
var userSchema = new Mongoose.Schema({
    username: {
        type: String,
        required: true
    },
    password: {
        type: String,
        required: true
    },
    age: {
        Number
    },
    sex: {
        type: Number,
        default: 0
    }
})

// 该数据对象和集合关联（“集合名”，schema对象）
var User = Mongoose.model('user', userSchema);

module.exports = User;